package org.ricks.log;

import java.io.Serializable;
import java.util.Comparator;

/**
 * @author chenwei
 * @Title:
 * @Package
 * @Description:
 * @date 2021/1/2917:34
 */
final class LastModifiedFileTupleComparator implements Comparator<FileTuple>, Serializable {

    static final LastModifiedFileTupleComparator INSTANCE = new LastModifiedFileTupleComparator();

    private static final long serialVersionUID = 1L;

    /** */
    private LastModifiedFileTupleComparator() {
    }

    @Override
    public int compare(final FileTuple first, final FileTuple second) {
        long firstModificationDate = first.getLastModified();
        long secondModificationDate = second.getLastModified();
        return (firstModificationDate < secondModificationDate) ? +1 : ((firstModificationDate == secondModificationDate) ? 0 : -1);
    }

}
